<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="jt.classic.system.user.IUser"%>
<%@ page import="jt.classic.system.ISystem"%>
<%@ page import="jt.classic.system.module.IMenu"%>
<%@ page import="jt.classic.system.module.IModule"%>
<%@ page import="jt.classic.system.module.ModuleManager"%>
<%@ page import="java.util.List"%>
<% 
    String context = jt.classic.system.ISystem.getContextPath();
    
    IUser user = ISystem.getSessionUser(request);
   
    response.setHeader("Pragma","No-cache");//HTTP 1.1 
    response.setHeader("Cache-Control","no-cache");//HTTP 1.0 
    response.setDateHeader("Expires",0);//防止被proxy

    List list = null;
    ModuleManager manager = new ModuleManager();
    try{
        list = manager.getMyModuleList(user);
    }catch(Exception ex){
        ex.printStackTrace(System.out);
    }finally {
        manager.clean();
    }
%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>模块/菜单导航</title>

<script src="js/prototype.lite.js" type="text/javascript"></script>
<script src="js/moo.fx.js" type="text/javascript"></script>
<script src="js/moo.fx.pack.js" type="text/javascript"></script>
<style>
body {
	font:12px Arial, Helvetica, sans-serif;
	color: #000;
	background-color: #EFEFEF;
	margin: 0px;
}
#container {
	width: 182px;
}
H1 {
	font-size: 12px;
	margin: 0px;
	width: 182px;
	cursor: pointer;
	height: 30px;
	line-height: 20px;	
}
H1 a {
	display: block;
	width: 182px;
	color: #434343;
	height: 30px;
	text-decoration: none;
	moz-outline-style: none;
	background-image: url(images/menu_bgs.gif);
	background-repeat: no-repeat;
	line-height: 30px;
	text-align: left;
	margin: 0px;
	padding-left: 20px;
}
.content{
	width: 182px;
	height: 0px;
	
}
.MM ul {
	list-style-type: none;
	margin: 0px;
	padding: 0px;
	display: block;
}
.MM li {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 26px;
	list-style-type: none;
	display: block;
	text-decoration: none;
	height: 26px;
	width: 182px;
	padding-left: 0px;
}

.clik {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 26px;
	font-weight: bold;
	color: #006600;
	list-style-type: none;
	display: block;
	text-decoration: none;
	height: 26px;
	width: 182px;
	padding-left: 0px;
}

.MM {
	width: 182px;
	margin: 0px;
	padding: 0px;
	left: 0px;
	top: 0px;
	right: 0px;
	bottom: 0px;
	clip: rect(0px,0px,0px,0px);
}
.MM a:link {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 26px;
	color: #333333;
	background-image: url(images/menu_bg1.gif);
	background-repeat: no-repeat;
	height: 26px;
	width: 182px;
	display: block;
	text-align: center;
	margin: 0px;
	padding: 0px;
	overflow: hidden;
	text-decoration: none;
}
.MM a:visited {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 26px;
	color: #333333;
	background-image: url(images/menu_bg1.gif);
	background-repeat: no-repeat;
	display: block;
	text-align: center;
	margin: 0px;
	padding: 0px;
	height: 26px;
	width: 182px;
	text-decoration: none;
}
.MM a:active {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 26px;
	color: #333333;
	background-image: url(images/menu_bg1.gif);
	background-repeat: no-repeat;
	height: 26px;
	width: 182px;
	display: block;
	text-align: center;
	margin: 0px;
	padding: 0px;
	overflow: hidden;
	text-decoration: none;
}
.MM a:hover {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 26px;
	font-weight: bold;
	color: #006600;
	background-image: url(images/menu_bg2.gif);
	background-repeat: no-repeat;
	text-align: center;
	display: block;
	margin: 0px;
	padding: 0px;
	height: 26px;
	width: 182px;
	text-decoration: none;
}

.liout{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 26px;
	color: #333333;
	background-image: url(images/menu_bg1.gif);
	background-repeat: no-repeat;
	height: 26px;
	width: 182px;
	display: block;
	text-align: left;
	margin: 0px;
	padding: 0px;
	overflow: hidden;
	text-decoration: none;
	cursor:hand;
}

.liover {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 26px;
	font-weight: bold;
	color: #333333;
	background-image: url(images/menu_bg2.gif);
	background-repeat: no-repeat;
	text-align: left;
	display: block;
	margin: 0px;
	padding: 0px;
	height: 26px;
	width: 182px;
	text-decoration: none;
	cursor:hand;
}
</style>
</head>
<script>
     var clickThizz;

     function handleOver(thizz){
         thizz.className = "liover";
     }
     
     function handleOut(thizz){
         if(clickThizz == thizz){
             //do nothing
         }else{
             thizz.className = "liout";
         }
     }

     function handleURL(id, url, title, thizz){       
         if(clickThizz){
             clickThizz.className = "liout";
         }
         
         clickThizz = thizz;
         
         //parent.document.frames['mainFrame'].handleURL(url, title);
         parent.document.getElementById("mainFrame").contentWindow.handleURL(id, url, title);
     }
</script>
<body>

<div id="container">
      <%
	   if(list != null && !list.isEmpty()){
	       for(int i=0;i<list.size();i++){
	           IModule module = (IModule)list.get(i);
	           List menus = module.imenus();
	  %>
	  <h1 class="type"><a href="javascript:void(0);"><%=module.iname() %></a></h1>
	  <div class="content">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/menu_topline.gif" width="182" height="5" /></td>
          </tr>
        </table>
	  <%
	           if(menus != null && !menus.isEmpty()){
	  %>
	  <ul class="MM">
	  <%      	   
	        	   for(int j=0;j<menus.size();j++){
	        		   String menuid = i+""+j;
	        		   IMenu menu = (IMenu)menus.get(j);
	        		   //String title = module.iname() + "/" + menu.iname();
	        		   String title = menu.iname();
	        		   String url = context + menu.iurl();
	  %> 
          <li class="liout" onmouseover="javascript:handleOver(this);" onmouseout="javascript:handleOut(this);" onclick="javascript:handleURL('<%=menu.id() %>', '<%=url %>', '<%=title %>', this);">
             <div style="margin-left:20px;"><img src="<%=context %>/newframe/images/arrow.gif">&nbsp;<%=menu.iname() %></div>
          </li>
	 <%
	        	   }
	 %>
	 </ul>
	 <% 
	           }
	 %>
	 </div>
	 <% 
	       }
	   }
	 %>
        <script type="text/javascript">
		var contents = document.getElementsByClassName('content');
		var toggles = document.getElementsByClassName('type');
	
		var myAccordion = new fx.Accordion(
			toggles, contents, {opacity: true, duration: 400}
		);
		myAccordion.showThisHideOpen(contents[0]);
	</script>
</body>
</html>
